#include "LoadTextInfo.h"

TextLoadMgr* TextLoadMgr::m_TextLoadMgr = NULL;


TextLoadMgr::TextLoadMgr()
{
}

TextLoadMgr::~TextLoadMgr()
{
	CC_SAFE_RELEASE(TextLoadMgr::m_CCDictionary);
	CC_SAFE_DELETE(TextLoadMgr::m_CCDictionary);
}


TextLoadMgr* TextLoadMgr::SharedTextLoadMgr()
{
	if (!m_TextLoadMgr)
	{
		m_TextLoadMgr = new TextLoadMgr();
		m_TextLoadMgr->init();
	}
	CCASSERT(m_TextLoadMgr, "Faild To Create TextLoadMgr!");
	return m_TextLoadMgr;

}

void TextLoadMgr::init()
{
	m_CCDictionary = CCDictionary::createWithContentsOfFile("Strings.Xml");
	m_CCDictionary->retain();

}


const char* TextLoadMgr::GetStringForKey(const string& key)
{
	return ((CCString*)m_CCDictionary->objectForKey(key))->getCString();
}